export function getDateOffsetFormat(offsetDays) {
  let date = new Date();
  date.setDate(date.getDate() + offsetDays);
  date = new Date(date);

  let year = date.getFullYear();
  let month = (date.getMonth() + 1).toString().padStart(2, '0');
  let day = date.getDate().toString().padStart(2, '0');
  return year + '-' + month +'-' + day;
}
/**
 * 基于baseDate 计算添加offsetDays天数后的格式化日期
 * @param baseDate yyyy-MM-dd
 * @param offsetDays 
 */
export function getDateOffsetFormat2(baseDate, offsetDays) {
  let date = new Date(baseDate);
  date.setDate(date.getDate() + offsetDays);
  date = new Date(date);

  let year = date.getFullYear();
  let month = (date.getMonth() + 1).toString().padStart(2, '0');
  let day = date.getDate().toString().padStart(2, '0');
  return year + '-' + month +'-' + day;
}

export function getNowFormatDate(offsetDays) {
  let date = new Date();
  date.setDate(date.getDate() + offsetDays);
  date = new Date(date);

  let year = date.getFullYear();
  let month = (date.getMonth() + 1).toString().padStart(2, '0');
  let day = date.getDate().toString().padStart(2, '0');
  return year + '-' + month +'-' + day;
}